object Sum {
  def SumRange(L: Int, R: Int): Int = {
    var res: Int = 0
    for (i <- L to R) res += i
    res
  }

  def SumSqure(L: Int, R: Int): Long = {
    var res: Long = 0
    for (i <- L to R) res += i * i
    res
  }

  def main(args: Array[String]) {
    println(SumRange(1, 4), SumSqure(1, 4))
  }
}